<div class="dux-tools">
  <div class="bread-head">附件管理 <span class="small">管理各个模块的附件</span> </div>
  <?php if(model('user_group')->model_power('upload_file','visit')){ ?>
  <br>
  <div class="tools-function clearfix">
    <div class="float-left"> <a class="button button-small bg-main icon-list" href="__URL__"> 附件列表</a> </div>
  </div>
  <?php } ?>
</div>
<div class="admin-main">
  <div class="panel dux-box">
    <div class="table-tools clearfix ">
      <div class="float-left">
        <div class="form-inline">
            <div class="form-group">
              <div class="field">
                <label>文件格式</label>
                <select onchange="javascript:location.href=this.value;" class="input">
            	<option value="__URL__/" >全部</option>
            	<option value="__URL__/index/ext-1" <?php if($_GET['ext']==1){ ?> selected="selected" <?php } ?>  >图片</option>
                <option value="__URL__/index/ext-2" <?php if($_GET['ext']==2){ ?> selected="selected" <?php } ?>  >媒体</option>
                <option value="__URL__/index/ext-3" <?php if($_GET['ext']==3){ ?> selected="selected" <?php } ?>  >文档</option>
                <option value="__URL__/index/ext-4" <?php if($_GET['ext']==4){ ?> selected="selected" <?php } ?>  >压缩</option>
                <option value="__URL__/index/ext-5" <?php if($_GET['ext']==5){ ?> selected="selected" <?php } ?>  >其他</option>
            </select>
              </div>
            </div>
            <div class="form-group">
              <div class="field">
                <label>所属模块</label>
                <select onchange="javascript:location.href=this.value;" class="input">
            	<option value="__URL__/">全部模块</option>
                <option value="__URL__/index/type-no"  <?php if($_GET['type']=='no'){ ?> selected="selected" <?php } ?>  >未关联模块</option>
                <!--foreach:{$module_list $vo}-->
            	<option value="__URL__/index/type-{$vo.type}" <?php if($_GET['type']==$vo['type']){ ?> selected="selected" <?php } ?> >{$vo.name}</option>
                <!--{/foreach}-->
            </select>
              </div>
            </div>
            <div class="form-group">
              <div class="field">
                <label>搜索</label>
                <input style="width:100px" name="search" type="text" class="input" id="search" value="<?php echo urldecode($_GET['search']) ?>" />
              </div>
            </div>
            <div class="form-button">
                <button class="button" type="button" onClick="javascript:location.href='__URL__/index/id-{$class_info.cid}-search-'+$('#search').val();">搜索</button>
            </div>
        </div>
      </div>
    </div>
    <div class="table-responsive">
      <table id="table" class="table table-hover ">
        <tbody>
          <tr>
            <th width="80">编号</th>
            <th width="*">文件名称</th>
            <th width="*">上传时间</th>
            <th width="*">模块</th>
            <th width="150">附件操作</th>
          </tr>
          <!--foreach:{$list $vo}-->
          <tr>
            <td>{$vo.id}</td>
            <td><?php if($vo['ext']=='jpg'||$vo['ext']=='jpeg'||$vo['ext']=='gif'||$vo['ext']=='bmp'||$vo['ext']=='png') { ?>
        <a href="javascript:;" rel="{$vo.file}" class="class_pic">{$vo.title}</a>
        <?php }else{ ?>
        {$vo.title} 
        <?php } ?>
            </td>
            <td>{$vo.time time="Y-m-d H:i:s"}</td>
            <td>{$vo.type}</td>
            <td>
            <?php if(model('user_group')->model_power('upload_file','del')){ ?>
            <a class="button bg-red button-small icon-trash-o js-del" href="javascript:void(0);" onclick="del('{$vo.id}',this)" title="删除"></a>
            <?php } ?>
            </td>
          </tr>
          <!--{/foreach}-->
        </tbody>
      </table>
    </div>
    <div class="panel-foot table-foot clearfix">
      <div class="float-right">
        <div class="page_tool">
          <div class="page" >{$page}</div>
        </div>
      </div>
    </div>
  </div>
</div>
<script>
//缩略图
$(".class_pic").powerFloat({
    targetMode: "ajax"
});
//删除
function del(id,obj) {
	var obj;
	ajaxpost({
		name:'确定要删除此附件？',
		url:"__URL__/del",
		data:{id: id},
		tip:1,
		success:function(){
			$(obj).parent().parent().remove();
		}
	});
}
</script>